package com.changgou.order.listener;

import com.changgou.order.config.RabbitMQConfig;
import com.changgou.order.service.OrderService;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @Author: HuangFu
 * @Date: 2020/2/20 14:05
 * @Description: 订单支付超时监听
 */
@Component
public class OrderTimeOutListener {

    @Autowired
    private OrderService orderService;



    /**
     * 订单超时支付处理
     * @param message
     */
    @RabbitListener(queues = RabbitMQConfig.QU_ORDERTIMEOUT)
    public void timeOutOrder(String message){
        System.out.println("接收订单关闭消息："+message);
        try{
            orderService.closeOrder(message);
        }catch (Exception e){
            e.printStackTrace();
        }
    }
}
